# def foo():
#     print('start')
#     print("foo")
#     print('end')
#
# def bar():
#     print('start')
#     print("bar")
#     print('end')

# def foo():
#     print('foo')
#
# def bar():
#     print('bar')
#
# def dec(f):
#     print('start')
#     f()
#     print('end')
#
# dec(foo)
# dec(bar)
l = [23, 4, 5, 67, 86, 21]
# print([i for i in l if i % 2 == 0])
# def get_even(item):
#     return item % 2 != 0
#
# print(list(filter(get_even, l)))
# print(list(filter(lambda x: x % 2 == 0, l)))
# print(list(map(lambda item: item * item, l)))
# data01 = [("yuan", 18), ("alex", 45), ("peiQi", 32)]
# def my_order(item):
#     return item[1]
# data02 = sorted(data01, key=my_order)
# print(data02)
# print(sorted(data01, key=lambda item: item[1], reverse=True))
data02 = [
    {"name":"yuan", "age":18, "height":192},
    {"name":"alex", "age":48, "height":162},
    {"name":"peiQi", "age":38, "height":172},
    {"name":"rain", "age":58, "height":182},
]
print(list(sorted(data02, key=lambda x:x["age"])))

print(list(sorted(data02, key=lambda x:x["height"])))